package com.cdel.akka.AkkainJAVA.demo3router;

import com.typesafe.config.ConfigFactory;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;

//router
public class AkkaMain5 {
	public static void main(String[] args) throws Exception {
		final ActorSystem system = ActorSystem.create("demo5", ConfigFactory.load("demo5").getConfig("demo5"));
		// 创建一个到greeter Actor的管道
		final ActorRef controlActor = system.actorOf(Props.create(ControlActor.class), "control");
		controlActor.tell(new StartCommand(1), ActorRef.noSender());
		controlActor.tell(new StartCommand(2), ActorRef.noSender());
		controlActor.tell(new StartCommand(3), ActorRef.noSender());
		controlActor.tell(new StartCommand(4), ActorRef.noSender());
		controlActor.tell(new StartCommand(5), ActorRef.noSender());
		controlActor.tell(new StartCommand(6), ActorRef.noSender());
		controlActor.tell(new StartCommand(7), ActorRef.noSender());
		controlActor.tell(new StartCommand(8), ActorRef.noSender());
		controlActor.tell(new StartCommand(9), ActorRef.noSender());
		//system.shutdown();
	}

	/**
	 * Insert3:Actor[akka://demo5/user/control/writer_2#408351274]
		Insert6:Actor[akka://demo5/user/control/writer_2#408351274]
		Insert9:Actor[akka://demo5/user/control/writer_2#408351274]
		Insert1:Actor[akka://demo5/user/control/writer_0#-262541214]
		Insert4:Actor[akka://demo5/user/control/writer_0#-262541214]
		Insert2:Actor[akka://demo5/user/control/writer_1#1780031580]
		Insert5:Actor[akka://demo5/user/control/writer_1#1780031580]
		Insert8:Actor[akka://demo5/user/control/writer_1#1780031580]
		Insert7:Actor[akka://demo5/user/control/writer_0#-262541214]
	 * */

}